﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Security.Claims;
using System.Text;

namespace Ls.Utils
{
    public static class ClaimExtensions
    {
        /// <summary>
        /// 获取Claim默认值
        /// </summary>
        /// <param name="Claims"></param>
        /// <param name="type"></param>
        /// <returns></returns>
        public static string FirstOrDefaultValue(this IEnumerable<Claim> Claims, string type) {
            Claim claim = Claims.FirstOrDefault(c => c.Type.ToUpper() == type.ToUpper());
            if (claim == null) return null;
            return claim.Value;
        }
    }
}
